package ar.com.angrymachine.hunter.gameplay;

import ar.com.angrymachine.hunter.ActivitySet;
import ar.com.angrymachine.hunter.Locale;

public class Player extends Character implements Fighter
{
    public int experience = 1;
    public ActivitySet activities = new ActivitySet(Locale.INVENTORY);
    public int defeatedArenaLevel = 0;
        
    public Player()
    {
    	super(80, 10, 0, 1);
    }
        
    public void grantExperience(int amount)
    {
        experience += amount;
        if(experience >= getNextLevelExperience())
        {
            // level up!
            level++;
            naturalExplorationSkill += 0.1;
            naturalFightingSkill += 0.1;
            naturalDisarmSkill += 0.1;
        }
    }
    
    public void grantExperienceForKilling(Monster m)
    {
        grantExperience(m.getLevel() * 10);
    }
    
    public int getNextLevelExperience()
    {
        return getLevel() * 5;
    }
    
    public void receiveTreasure(Treasure treasure)
    {
        gold += treasure.gold;
        if(treasure.object != null)
        {
            inventory.add(treasure.object);
        }
    }
    
	public int getCastDelta(int delta)
	{
		return (int) (delta * (2 - naturalMagicSkill));
	}

	public void levelUp()
	{
		naturalExplorationSkill += 0.1;
		naturalFightingSkill += 0.1;
		naturalDisarmSkill += 0.1;
		naturalMagicSkill += 0.1;
	}
}
